package com.woniuxy.yogaapp.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.woniuxy.yogaapp.pojo.Indexmes;

public interface IndexMapper {
	/**
	 * 查询所有推送消息
	 * 
	 * @return
	 */
	@Select("select * from indexmes")
	List<Indexmes> findAllIndexmes();

	// 新增推送消息
	@Insert("insert into indexmes (yid,cid,`describe`,state) values (#{param1},#{param2},#{param3},'未推送')")
	int addIndexmes(int yid, int cid, String describe);

	// 删除推送消息
	@Delete("delete from indexmes where mesid=#{mesid}")
	int deleteIndexmes(int mesid);

	// 推送消息至主页
	@Update("update indexmes set state='已推送' where mesid=#{mesid}")
	int changeMestoIndex(int mesid);

	// 撤销消息推送
	@Update("update indexmes set state='未推送' where mesid=#{mesid}")
	int changeMesagain(int mesid);

	// 查询已推送的消息
	@Select("select * from indexmes where state='已推送'")
	List<Indexmes> findstateIndexmes();
}
